<?php
	/**
	 * 商品搜索接口
	 * Created by:
	 * User: wangs
	 * Date: 2024/4/23
	 */
	declare (strict_types=1);

	namespace pangolin\sdk\api;


    require_once ROOT_PATH.'extend/dy-sdk/src/http/PopBaseHttpRequest.php';

	use pangolin\sdk\http\PopBaseHttpRequest;

	class ProductSearchRequest extends PopBaseHttpRequest
	{

		/**
		 * @JsonProperty(Integer, "page")
		 */
		private  $page=0;//商品第几页，从1开始
		/**
		 * @JsonProperty(Integer, "page_size")
		 */
		private  $page_size=20;//商品每页数量，最大20，最小1
		/**
		 * 商品关键词
		 * @var string
		 */
		private  $cursor='';
		private  $count = null;
		private  $sort_by = null;
		private  $order_by = null;
		private  $city_code = null;
		private  $longitude = null;
		private  $latitude = null;
		private  $distance_max = null;
		private  $category_id = null;
		private  $keyword = null;




		/**
		 * @return string
		 */
		public function getType(): string
		{
			return "/life/product/search";
		}


		/**
		 * @param $var
		 * @return void
		 */
		protected function setUserParams(&$var)
		{
			$this->setUserParam($var, "cursor", $this->cursor);
            $this->setUserParam($var, "count", $this->count);
            $this->setUserParam($var, "sort_by", $this->sort_by);
            $this->setUserParam($var, "order_by", $this->order_by);
            $this->setUserParam($var, "city_code", $this->city_code);
            $this->setUserParam($var, "longitude", $this->longitude);
            $this->setUserParam($var, "latitude", $this->latitude);
            $this->setUserParam($var, "distance_max", $this->distance_max);
            $this->setUserParam($var, "category_id", $this->category_id);
            $this->setUserParam($var, "keyword", $this->keyword);
		}


		//游标。注意：首次查询时传空，第二次查询传第一次查询返回值中的cursor
		public function setCursor($cursor){
			$this->cursor=intval($cursor);
		}

        public function setCount($count){
            $this->count=intval($count);
        }

        public function setSortBy($sort_by){
            $this->sort_by=intval($sort_by);
        }

        public function setOrderBy($order_by){
            $this->order_by=intval($order_by);
        }


        public function setCityCode($city_code){
            $this->city_code=$city_code;
        }

        public function setLongitude($longitude){
            $this->longitude=doubleval($longitude);
        }

        public function setLatitude($latitude){
            $this->latitude=doubleval($latitude);
        }

        public function setDistanceMax($distance_max){
            $this->distance_max=$distance_max;
        }

        public function setCategoryId($category_id){

            $this->category_id=intval($category_id);
        }

        public function setKeyword($keyword){
            $this->keyword=$keyword;
        }

	}